{include file="public/header"}
<!-- 表单 -->
<style>
    .layui-form-label {
        width: 100px;
    }

    .layui-input-block {
        margin-left: 130px;
    }

    .layui-form-item {
        margin-right: 30%;
    }

    .layui-upload-img {
        width: 100px;
        height: 100px;
        line-height: 100px;
        text-align: center;
        border: 1px solid #ccc;
    }

    .layui-upload-img img {
        max-width: 100%;
        max-height: 100%;
        margin: auto auto;
    }
</style>
</head>

<body>
    <div class="cBody">
        <form id="addForm" class="layui-form" action="">
            <div class="layui-form-item">
                <label class="layui-form-label">缩略图</label>
                <div class="layui-input-inline" style="width: 120px;">
                    <div class="layui-upload-img">
                        <img src="" id="fileslist">
                    </div>
                    <input type="hidden" name="thum" autocomplete="off" class="layui-input fileslist" value="">
                </div>
                <a href="javascript:;" class="layui-btn layui-btn-primary"
                    onclick="OpenView('{:url('Login/uploads')}?num=1&id=fileslist','文件上传')">文件上传</a>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">类型名称</label>
                <div class="layui-input-block">
                    <input type="text" name="name" autocomplete="off" class="layui-input" value="">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">上级ID</label>
                <div class="layui-input-block">
                    <select name="parent_id" lay-filter="parent_id">
                        <option value="0">顶级类型</option>
                        {volist name="select" id="v"}
                        <option value="{$v.id}"><?php echo str_repeat('&emsp;&emsp;',$v['level']*1); ?>{$v.name}</option>
                        {/volist}
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">描述</label>
                <div class="layui-input-block">
                    <input type="text" name="desc" autocomplete="off" class="layui-input" value="">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="submitBut">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>

        <script>
            //表单提交
            layui.use(['form', 'layer'], function () {
                var form = layui.form;
                var layer = layui.layer;
                form.render();
                //监听提交
                form.on('submit(submitBut)', function (data) {
                    ajax_submit(data.field, '', 'demo');
                    return false;
                });
            });
        </script>
    </div>
</body>
{include file="public/footer"}